<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>构造函数创建对象</title>
		<script>
			/* 
			这种方式我们将会在es6的新特性中讲
			class Person{
				name = '大周老师';
			}
			var p = new Person();
			console.log(p.name); */
			
			function Person(name,age,sex){
				this.name = name;
				this.age = age;
				this.sex = sex;
				this.city = '北京';
				this.say = function(){
					console.log('说话');
				}
				this.run = function(username){
					console.log(username + '跑起来了' + this.name);
					return username;
				}
			}
			
			var dazhou = new Person('大周老师',18, '男');
			console.log(dazhou.name);
			console.log(dazhou.age);
			console.log(dazhou.sex);
			console.log(dazhou.city);
			dazhou.say();
			var username = dazhou.run('小明');
			console.log(username);
			
		</script>
	</head>
	<body>
	</body>
</html>